package com.yunxi.service.dubboService.impl.customer;

import com.github.pagehelper.PageInfo;
import com.yunxi.customer.pojo.CustomerFlowVO;
import com.yunxi.customer.service.CustomerFlowDubboService;
import com.yunxi.model.customer.CustomerFlow;
import com.yunxi.service.localService.customer.CustomerFlowService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

import java.lang.reflect.InvocationTargetException;
import java.util.List;

/**
 * <p>
 * 客户流量 服务实现类
 * </p>
 *
 * @author 
 * @since 2019-08-24
 */
public class CustomerFlowDubboServiceImpl implements CustomerFlowDubboService {

    @Autowired
    @Qualifier(value = "customerFlowServiceImpl")
    CustomerFlowService customerFlowService;


    @Override
    public CustomerFlowVO getById(String id) throws InvocationTargetException, IllegalAccessException {
    CustomerFlow customerFlow = customerFlowService.getById(id);
    CustomerFlowVO customerFlowVO = new CustomerFlowVO();
        BeanUtils.copyProperties(customerFlow,customerFlowVO);
        return customerFlowVO;
    }

    @Override
    public void saveOrUpdate(CustomerFlowVO customerFlowVO) throws InvocationTargetException, IllegalAccessException {
    CustomerFlow customerFlow = new CustomerFlow();
        BeanUtils.copyProperties(customerFlowVO,customerFlow);
    customerFlowService.saveOrUpdate(customerFlow);
    }

    @Override
    public void removeById(String id) {
    customerFlowService.removeById(id);
    }

    @Override
    public PageInfo<CustomerFlowVO> findPageByVO(CustomerFlowVO customerFlowVO, Integer pageNum, Integer pageSize) throws InvocationTargetException, IllegalAccessException {
      PageInfo<CustomerFlowVO> pageInfo = customerFlowService.pageByVo(customerFlowVO,pageNum,pageSize);
      return pageInfo;
   }

    @Override
    public void removeByListVo(List<CustomerFlowVO> customerFlowVOList) throws IllegalAccessException, InvocationTargetException, InstantiationException {
        customerFlowService.removeByListVo(customerFlowVOList);
    }

    @Override
    public List listByVo(CustomerFlowVO customerFlowVO) {
      return customerFlowService.listByVo(customerFlowVO);
    }
}
